package com.study.practice.java8;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description : java8 lambda forEach测试
 * @Version : V1.0.0
 * @Date : 2021/12/2 13:54
 */
public class ForEachTest {
    public static void main(String[] args) {
        List<String> list = Arrays.asList("张三", "李四", "王五", "赵六", "钱七", "孙八");
        list.stream().filter(item -> item.equals("张三") || item.equals("李四")).forEach(System.out::println);
        list.stream().sorted().collect(Collectors.toList());
    }
}
